package com.lutzyt.delivery.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lutzyt.delivery.bean.PermissionMenu;
import com.lutzyt.delivery.service.PermissionMenuService;
import com.lutzyt.delivery.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 * @author zyt
 */
@RestController
@RequestMapping("/api/permission/menu")
public class PermissionMenuController {
  private PermissionMenuService permissionMenuService;

  @GetMapping("/{id}")
  public Result<PermissionMenu> findById(@ApiParam("ID") @PathVariable("id") Integer id) {
    return Result.success(permissionMenuService.findById(id));
  }

  @PostMapping
  @ApiOperation("新增")
  public Result<Void> insert(@RequestBody PermissionMenu permissionMenu) {
    permissionMenuService.insert(permissionMenu);
    return Result.success();
  }

  @Autowired
  public void setPermissionMenuService(PermissionMenuService permissionMenuService) {
    this.permissionMenuService = permissionMenuService;
  }
}
